xl: do not return to caller from monitoring daemon
authorIan Campbell <ian.campbell@citrix.com>
Wed, 8 Sep 2010 15:24:20 +0000 (16:24 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Wed, 8 Sep 2010 15:24:20 +0000 (16:24 +0100)
The parent process will have returned to the caller and done whatever
is necessary. The daemon should not return otherwise it will repeat
this work. In the case of the migration receiver this causes it to try
and take part in the migration protocol long after the sender+parent
process have completed it, leading to confusing error messages
(although strangely not much actual damange).

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxl/xl_cmdimpl.c

index 9393059e710371af13f8bb9043a1f3276b811d3b..c2bfa0d311cfa4cd921f3dd267d09a915c51546c 100644 (file)
@@ -1645,6 +1645,14 @@ waitpid_out:
     if (child_console_pid > 0 &&
             waitpid(child_console_pid, &status, 0) < 0 && errno == EINTR)
         goto waitpid_out;
+
+    /*
+     * If we have daemonized then do not return to the caller -- this has
+     * already happened in the parent.
+     */
+    if ( !need_daemon )
+        exit(ret);
+
     return ret;
 }